package org.chench.test.testrabbitmq.model;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * Desc: 发送者
 * Name: org.chench.test.testrabbitmq.model.Sender
 * Author: chench9@lenovo.com
 * Date: 2018/4/27 14:54
 **/
@Component
public class Sender {
    @Autowired
    private AmqpTemplate amqpTemplate;

    public void send() {
        String context = "Hello, " + new Date();
        System.out.println("Send: " + context);
        this.amqpTemplate.convertAndSend(MqConstants.QUEU_HELLO, context);
    }
}
